# -*- coding: utf-8 -*-

import pickle

from functools import update_wrapper
from kay_authsub.models import Token
from kay_authsub.utils import get_authsub_token_from_request

def with_authsub_token(func):
  def inner(request, *args, **kwargs):
    kwargs.update({'authsub_token':
                     get_authsub_token_from_request(request)})
    return func(request, *args, **kwargs)
  update_wrapper(inner, func)
  return inner
